class Solution {
    public boolean isAnagram(String s, String t) {
        int[] arr=new int[26];
        int len1=s.length();
        int len2=s.length();
        for(int i=0;i<len1;i++){
            int index=s.charAt(i)-'a';
            arr[index]++;
        }
        for(int i=0;i<len2;i++){
            int index=t.charAt(i)-'a';
            arr[index]--;
            if(arr[index]<0){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Solution solution=new Solution();
        solution.isAnagram("a","ab");
    }
}